<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>ActiveRecord::SchemaMigration</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/github.css" type="text/css" media="screen" />
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>

</head>

<body>     
    <div class="banner">
        
            <span>Ruby on Rails v4.0.0</span><br />
        
        <h1>
            <span class="type">Class</span> 
            ActiveRecord::SchemaMigration 
            
                <span class="parent">&lt; 
                    
                    <a href="Base.html">ActiveRecord::Base</a>
                    
                </span>
            
        </h1>
        <ul class="files">
            
            <li><a href="../../files/activerecord/lib/active_record/schema_migration_rb.html">activerecord/lib/active_record/schema_migration.rb</a></li>
            
        </ul>
    </div>
    <div id="bodyContent">
        <div id="content">
  


  


  
  


  


  
    <!-- Method ref -->
    <div class="sectiontitle">Methods</div>
    <dl class="methods">
      
        <dt>C</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="SchemaMigration.html#method-c-create_table">create_table</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>D</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="SchemaMigration.html#method-c-drop_table">drop_table</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>I</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="SchemaMigration.html#method-c-index_name">index_name</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>T</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="SchemaMigration.html#method-c-table_name">table_name</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>V</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="SchemaMigration.html#method-i-version">version</a>
              </li>
            
          </ul>
        </dd>
      
    </dl>
  

  



  

    

    

    


    


    <!-- Methods -->
    
      <div class="sectiontitle">Class Public methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-c-create_table">
            
              <b>create_table</b>(limit=nil)
            
            <a href="SchemaMigration.html#method-c-create_table" name="method-c-create_table" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-c-create_table_source')" id="l_method-c-create_table_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/8744632fb5649cf26cdcd1518a3554ece95a401b/activerecord/lib/active_record/schema_migration.rb#L16" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-c-create_table_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/schema_migration.rb, line 16</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">self</span>.<span class="ruby-identifier">create_table</span>(<span class="ruby-identifier">limit</span>=<span class="ruby-keyword">nil</span>)
  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">connection</span>.<span class="ruby-identifier">table_exists?</span>(<span class="ruby-identifier">table_name</span>)
    <span class="ruby-identifier">version_options</span> = {<span class="ruby-identifier">null</span><span class="ruby-operator">:</span> <span class="ruby-keyword">false</span>}
    <span class="ruby-identifier">version_options</span>[<span class="ruby-value">:limit</span>] = <span class="ruby-identifier">limit</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">limit</span>

    <span class="ruby-identifier">connection</span>.<span class="ruby-identifier">create_table</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">id</span><span class="ruby-operator">:</span> <span class="ruby-keyword">false</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">t</span>.<span class="ruby-identifier">column</span> <span class="ruby-value">:version</span>, <span class="ruby-value">:string</span>, <span class="ruby-identifier">version_options</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">connection</span>.<span class="ruby-identifier">add_index</span> <span class="ruby-identifier">table_name</span>, <span class="ruby-value">:version</span>, <span class="ruby-identifier">unique</span><span class="ruby-operator">:</span> <span class="ruby-keyword">true</span>, <span class="ruby-identifier">name</span><span class="ruby-operator">:</span> <span class="ruby-identifier">index_name</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-c-drop_table">
            
              <b>drop_table</b>()
            
            <a href="SchemaMigration.html#method-c-drop_table" name="method-c-drop_table" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-c-drop_table_source')" id="l_method-c-drop_table_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/8744632fb5649cf26cdcd1518a3554ece95a401b/activerecord/lib/active_record/schema_migration.rb#L28" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-c-drop_table_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/schema_migration.rb, line 28</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">self</span>.<span class="ruby-identifier">drop_table</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">connection</span>.<span class="ruby-identifier">table_exists?</span>(<span class="ruby-identifier">table_name</span>)
    <span class="ruby-identifier">connection</span>.<span class="ruby-identifier">remove_index</span> <span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">name</span><span class="ruby-operator">:</span> <span class="ruby-identifier">index_name</span>
    <span class="ruby-identifier">connection</span>.<span class="ruby-identifier">drop_table</span>(<span class="ruby-identifier">table_name</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-c-index_name">
            
              <b>index_name</b>()
            
            <a href="SchemaMigration.html#method-c-index_name" name="method-c-index_name" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-c-index_name_source')" id="l_method-c-index_name_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/8744632fb5649cf26cdcd1518a3554ece95a401b/activerecord/lib/active_record/schema_migration.rb#L12" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-c-index_name_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/schema_migration.rb, line 12</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">self</span>.<span class="ruby-identifier">index_name</span>
  <span class="ruby-node">&quot;#{Base.table_name_prefix}unique_schema_migrations#{Base.table_name_suffix}&quot;</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-c-table_name">
            
              <b>table_name</b>()
            
            <a href="SchemaMigration.html#method-c-table_name" name="method-c-table_name" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-c-table_name_source')" id="l_method-c-table_name_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/8744632fb5649cf26cdcd1518a3554ece95a401b/activerecord/lib/active_record/schema_migration.rb#L8" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-c-table_name_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/schema_migration.rb, line 8</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">self</span>.<span class="ruby-identifier">table_name</span>
  <span class="ruby-node">&quot;#{Base.table_name_prefix}schema_migrations#{Base.table_name_suffix}&quot;</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                  
      <div class="sectiontitle">Instance Public methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-i-version">
            
              <b>version</b>()
            
            <a href="SchemaMigration.html#method-i-version" name="method-i-version" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-version_source')" id="l_method-i-version_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/8744632fb5649cf26cdcd1518a3554ece95a401b/activerecord/lib/active_record/schema_migration.rb#L35" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-version_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/schema_migration.rb, line 35</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">version</span>
  <span class="ruby-keyword">super</span>.<span class="ruby-identifier">to_i</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                    </div>

    </div>
  </body>
</html>    